home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / bib.vim < prev    next >
Encoding:
Text File  |  2001-09-02  |  3.5 KB  |  93 lines

  1. " Vim syntax file
  2. " Language:    BibTeX (bibliographic database format for (La)TeX)
  3. " Maintainer:    Bernd Feige <Bernd.Feige@gmx.net>
  4. " Filenames:    *.bib
  5. " Last Change:    Apr 26, 2001
  6. " URL:        http://home.t-online.de/home/Bernd.Feige/bib.vim
  7.  
  8. " Thanks to those who pointed out problems with this file or supplied fixes!
  9.  
  10. " Initialization
  11. " ==============
  12. " For version 5.x: Clear all syntax items
  13. " For version 6.x: Quit when a syntax file was already loaded
  14. if version < 600
  15.   syntax clear
  16. elseif exists("b:current_syntax")
  17.   finish
  18. endif
  19.  
  20. " Ignore case
  21. syn case ignore
  22.  
  23. " Keywords
  24. " ========
  25. syn keyword bibType contained    article book booklet conference inbook
  26. syn keyword bibType contained    incollection inproceedings manual
  27. syn keyword bibType contained    mastersthesis misc phdthesis
  28. syn keyword bibType contained    proceedings techreport unpublished
  29. syn keyword bibType contained    string
  30.  
  31. syn keyword bibEntryKw contained    address annote author booktitle chapter
  32. syn keyword bibEntryKw contained    crossref edition editor howpublished
  33. syn keyword bibEntryKw contained    institution journal key month note
  34. syn keyword bibEntryKw contained    number organization pages publisher
  35. syn keyword bibEntryKw contained    school series title type volume year
  36. " Non-standard:
  37. syn keyword bibNSEntryKw contained    abstract isbn issn keywords url
  38.  
  39. " Clusters
  40. " ========
  41. syn cluster bibVarContents    contains=bibUnescapedSpecial,bibBrace,bibParen
  42. " This cluster is empty but things can be added externally:
  43. "syn cluster bibCommentContents
  44.  
  45. " Matches
  46. " =======
  47. syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1
  48. syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField
  49. syn match bibVariable contained /[^{}," \t=]/
  50. syn region bibComment start=/^/ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
  51. syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents
  52. syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents
  53. syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents
  54. syn region bibField contained start="\S\+\s*=\s*" end=/[}),]/me=e-1 contains=bibEntryKw,bibNSEntryKw,bibBrace,bibParen,bibQuote,bibVariable
  55. syn region bibEntryData contained start=/[{(]/ms=e+1 end=/[})]/me=e-1 contains=bibKey,bibField
  56. " Actually, 5.8 <= Vim < 6.0 would ignore the `fold' keyword anyway, but Vim<5.8 would produce
  57. " an error, so we explicitly distinguish versions with and without folding functionality:
  58. if version < 600
  59.   syn region bibEntry start=/@\S\+[{(]/ end=/^\s*[})]/ transparent contains=bibType,bibEntryData nextgroup=bibComment
  60. else
  61.   syn region bibEntry start=/@\S\+[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment
  62. endif
  63.  
  64. " Synchronization
  65. " ===============
  66. syn sync match All grouphere bibEntry /^\s*@/
  67. syn sync maxlines=200
  68. syn sync minlines=50
  69.  
  70. " Highlighting defaults
  71. " =====================
  72. " Define the default highlighting.
  73. " For version 5.7 and earlier: only when not done already
  74. " For version 5.8 and later: only when an item doesn't have highlighting yet
  75. if version >= 508 || !exists("did_bib_syn_inits")
  76.   if version < 508
  77.     let did_bib_syn_inits = 1
  78.     command -nargs=+ HiLink hi link <args>
  79.   else
  80.     command -nargs=+ HiLink hi def link <args>
  81.   endif
  82.   HiLink bibType    Identifier
  83.   HiLink bibEntryKw    Statement
  84.   HiLink bibNSEntryKw    PreProc
  85.   HiLink bibKey        Special
  86.   HiLink bibVariable    Constant
  87.   HiLink bibUnescapedSpecial    Error
  88.   HiLink bibComment    Comment
  89.   delcommand HiLink
  90. endif
  91.  
  92. let b:current_syntax = "bib"
  93.